<?
$conn = new MySQLi('wyvern.cs.newpaltz.edu', 'N02036842', 's741780', 'N02036842_db');

function GetUser($id)
{
	global $conn;
	$results = $conn->query("SELECT * FROM Courses WHERE id=$id");
	if($rs = $results->fetch_assoc())
	{
		return $rs;
	}
	return null;
}
//*****************************************************
function DeleteUser($id)
{
	global $conn;
	$conn->query("DELETE FROM Courses WHERE id=$id");
}
//*****************************************************
function ValidateUser($rs)
{
	$returnValue = null;
	
	if(!isset($rs['Name']) || $rs['Name'] == '')
		$returnValue['FirstName'] = 'Is Required';
	return $returnValue;
}
//*****************************************************
function CreateUser($rs)
{
	global $conn;
	$sql = "Insert Into Courses (Name) Values ('$rs[Name]')";
	echo $sql;
	$conn->query( $sql );
}
//*****************************************************
function EditUser($rs)
{
	global $conn;
	$sql = "UPDATE Courses SET Name = '$rs[Name]' WHERE id=$rs[id]";
	$conn->query($sql);
}
// Do not close php tag for this include file